<template>
    <base-dialog  v-bind="$attrs" v-on="$listeners" :title="title" width="600px" @submit="toSubmit">
        <el-form  ref="elForm" label-width="80px" :model="formData" :rules="rules">
            <el-form-item label="补货量" prop="count">
                <el-input-number v-model="formData.count" :min="0"></el-input-number>
            </el-form-item>
            <el-form-item label="进价" prop="price2">
                <el-input-number v-model="formData.price2" :min="0"></el-input-number>
            </el-form-item>
        </el-form>
    </base-dialog>
</template>
<script>
    import BaseDialog from "../../../components/Common/BaseDialog";
    import goods from "@/api/goodsManagement/goods/index"
    import DetailDialog from "@/mixins/DetailDialog";
    export default {
        name:"RestockDialog",
        mixins:[DetailDialog],
        data(){
          return {
              formData:{
                  count:1,
                  price2:0
              },
              rules:{
                  count: [
                      { required: true, message: "补货量不能为空", trigger: "blur" }
                  ],
              },
              categoryList:[]
          }
        },
        created() {
        },
        components: { BaseDialog},
        computed:{
            title() {
                return `请输入【${this.row.name}】补货数量`
            },
        },
        methods:{
            toSubmit(){
                this.$refs['elForm'].validate(valid => {
                    if (!valid) return
                    goods.restock(this.row.id,this.formData).then(res=>{
                       this.closeAndReload(res)
                    })
                })
            }
        }
    }
</script>
